package Num07_20200303;

import java.util.Scanner;

public class Num07_20200303_hxj {
    public static void main(String[] args) {
        System.out.println("请输入字符串：");

        Scanner scan = new Scanner(System.in);
        String Str = scan.nextLine();
        int countL = 0,countD = 0,countS =0,countA =0;
        char[] scanChar = Str.toCharArray();//将接收到的字符串变成字符数组
        for(int i = 0;i<scanChar.length;i++){
            if(Character.isLetter(scanChar[i])){
                countL++;
            }else if(Character.isDigit(scanChar[i])){
                countD++;
            }else if(Character.isSpaceChar(scanChar[i])){
                countS++;
            }else{
                countA++;
            }
        }
        System.out.println("中英文字母个数："+countL);//汉字也算做了字符
        System.out.println("数字个数："+countD);
        System.out.println("空格个数："+countS);
        System.out.println("其他字符个数："+countA);
    }
}
